local shunfu = fk.CreateSkill{
    name = "jin_heg__shunfu",
    tags = { Skill.Limited },
}

local H = require "packages.ol_hegemony.util"

Fk:loadTranslationTable{
  ["jin_heg__shunfu"] = "瞬覆",
  [":jin_heg__shunfu"] = "限定技，出牌阶段，你可令至多三名未确定势力的其他角色各摸两张牌，然后这些角色依次选择是否使用一张无距离限制且不可响应的【杀】。",
  ["#jin_heg__shunfu_prompt"] = "瞬覆：选择至多三名未确定势力的其他角色",
  ["#jin_heg__shunfu_askForSlash"] = "瞬覆：你可以使用一张无距离限制且不可响应的【杀】",

  ["$jin_heg__shunfu1"] = "烈士雄心，志存高远。",
  ["$jin_heg__shunfu2"] = "乱世之中，唯我司马！",
}

shunfu:addEffect("active",{
    anim_type = "drawcard",
    prompt = "#jin_heg__shunfu_prompt",
    card_num = 0,
    can_use = function (self, player)
      return player:usedSkillTimes(shunfu.name, Player.HistoryGame) < 1 and table.find(Fk:currentRoom().alive_players, function (p) return  H.getKingdom(p) == "unknown" and p.id ~= player.id end)
    end,
    card_filter = Util.FalseFunc,
    target_filter = function (self, player, to_select, selected)
      return #selected < 3 and H.getKingdom(to_select) == "unknown" and to_select ~= player
    end,
    on_use = function (self, room, effect)
      local player = effect.from
      for _, to in ipairs(effect.tos) do
        to:drawCards(2, shunfu.name)
      end
      if player.dead then return end
      room:sortByAction(effect.tos)
      for _, to in ipairs(effect.tos) do
        if to.dead then return end
        local use = room:askToUseCard(to,{
            pattern = "slash|.|.|.|.|.|.",
            prompt = "#jin_heg__shunfu_askForSlash",
            skill_name = shunfu.name,
            cancelable = true,
            extra_data = {bypass_distances = true},
        })
        if use then
            use.disresponsiveList = use.disresponsiveList or {}
            table.insertTableIfNeed(use.disresponsiveList, room:getAlivePlayers())
            room:useCard(use)
          end
      end
    end
})

return shunfu